home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk8 / debug / debug.docs next >
Text File  |  1995-03-18  |  11KB  |  314 lines

  1.  
  2.                     -- Amiga Debugger --
  3.  
  4. Software and documentation by Jim Thibodeau and Larry LaPlume.
  5.  
  6. Amiga Debugger is the official resident debugger here at SLADE Software.
  7.  
  8. This is the first release of this utility. We here at SLADE welcome
  9. opinions, suggestions and bug reports. The only way we can fix it is
  10. if we know there is something wrong!
  11.  
  12. We can be reached at Acorn BBS (207) 772-0156 (c/o Larry LaPlume).
  13. Or you can write to us:
  14.  
  15.     Jim Thibodeau                Larry Laplume
  16.     40 Ryefield Dr.                P.O. box 5291 Station A
  17.     Old Orchard Beach, ME. 04064        Portland, ME 04101
  18.  
  19.  
  20.                     --  Debug Commands --
  21.  
  22. Command line syntax:
  23.    Is geared toward the heavy duty hacker.   Generally, a command
  24. line consists of a single letter command,  an optional space, and
  25. 1 or two arguments.  Arguments may be numeric as with Disassemble
  26. and Memory dump or string as with  Load file.  Some commands take
  27. no arguments,  such  as  eXit  and  display  Segment  list.   The
  28. Disassemble and  Memory  dump  commands  take  arguments  only in
  29. Hexidecimal form, or  from  the  contents  of  any  of the 8 Data
  30. registers, the  8  Address  registers,  or  the  Program  Counter
  31. register.   When  specifying  the  contents  of  a  register, the
  32. desired register MUST be enclosed in parenthesis.
  33.  
  34.    Note that Debug shares  its  very  own  Task Control Structure
  35. with the program being  debugged.   Things that the program being
  36. debugged does to  its Task  Control  Structure,  it automatically
  37. does to Debug's Task Control  Structure.   For example, a program
  38. being debugged, that calls the dos.library  Exit() function, will
  39. also cause the debugger to Exit().
  40.  
  41.    When  Disassembling  or  dumping  memory,  none,  one  or  two
  42. arguments may be given.  If no  argument  is given, the operation
  43. will begin where the last operation left off.  If one argument is
  44. given, the operation  will  begin  at  the address specified, and
  45. continue for a few  lines.   If  two  arguments  are  given,  the
  46. operation will begin with  the  address  specified  by  the first
  47. argument, and continue to the  second  argument.  The disassemble
  48. and memory dump routines both support the ^c user break keystroke
  49. to stop them from continuing to their normal completion.
  50.  
  51.    When the debugger is ready to accept  commands it will display
  52. a minus sign as a  prompt.   Commands  may  then  be typed at the
  53. keyboard, followed  by  the  return  or  enter  keys on the Amiga
  54. keyboard.  A space after the  single  letter  prompt is optional,
  55. but a space before the  single  letter  command  will confuse the
  56. debugger. Thus:
  57.  
  58. -d 100 200
  59. -d100 200
  60. -d         100         200
  61.  
  62. All do the same thing, while:
  63.  
  64. -  d 100 200
  65.  
  66. Will not work at all.
  67.  
  68. Here is a list of  supported  commands  that  may be typed at the
  69. prompt:
  70.  
  71. Command: D   (Disassemble memory)
  72. Examples:
  73. -d 100 200   Will disassemble memory from address $100 to $200
  74.  
  75. -d (a0)      Disassemble  memory  pointed  to by the contents of
  76.          register A0.
  77.  
  78. -d  (pc)     Disassemble  memory  at  the  value of the Program
  79.          Counter.
  80.  
  81. -d (a0,d0)   Disassemble memory at the value of the register A0
  82.          plus the contents of the  D0  register.  This  is  
  83.          similar to the processor's  d(An,Xi)  mode  except  
  84.          for  the  lack of index size specifier - the  size  
  85.          always  being  long,  and  the lack of any dis-
  86.          placement value.
  87.  
  88. Command: M   (Memory dump)
  89. Example:
  90. -m 100 200   Display memory contents from address $100 to $200
  91.  
  92. -m (sp)      Display  memory  contents  pointed  to  by the stack
  93.          pointer.
  94.  
  95. Command: X   (eXit the debugger)
  96. Example:
  97. -x           Quit debug utility.
  98.  
  99.  
  100. Command: S   (Show Segment list of loaded file)
  101. Example:
  102. -s           Display segment list of last file loaded.
  103.  
  104. Command: L   (Load a file for debugging)
  105. Example:
  106. -l [[path/]Filespec]  Will read a file from disk into memory.
  107.  
  108. Command:  R  (Display MC68000 Register/Flag values)
  109. Example:
  110. -r           Display the contents of important MC68000 registers.
  111.  
  112.  Using the r command at the  prompt  with  no parameters displays
  113. the contents of the Amiga's MC68000's registers and flags.
  114.  
  115.  
  116. Command: R   (Modify MC68000 Register/Flag values)
  117. Examples:
  118. -r a0 100    Load register A0 with the value $100.
  119.  
  120. -r d0 +100   Loads register D0 with the decimal value +100.
  121.  
  122. -r d0 -1     Loads register d0 with the decimal value of -1.
  123.  
  124. -r sr %101   Loads the  Status  Register  with  the  binary value
  125.          %101.
  126.  
  127. -r z 1       Forces the Zero flag on.
  128.  
  129.  All registers and flags that  are  displayed with the -r command
  130. may be modified with  the  -r  command  as  well.  Just  type the
  131. Motorola standard Symbol name of the register or flag followed by
  132. the  desired  value.   Note  that  Flags  may  be  either  0 or 1
  133. corresponding to off and on, clear or set.
  134.  
  135. Values entered may be preceeded by a "+" sign to denote a decimal
  136. number, a "-" sign to denote  a  negative  decimal  number, a "%"
  137. sign to permit entry of a binary number,  or a "$" sign to denote
  138. a hexidecimal number. If no  leading  sign is entered the default
  139. is hexidecimal. 
  140. Use care when directly  modifying  the program counter and status
  141. registers.
  142.  
  143. Command: C   (Set Command Line Tail)
  144. Example:
  145. -c Desired Command line tail
  146.  
  147.       Declare "Desired Command line tail" as a command tail.  The
  148. Debugger will set up the string in  memory, and install a pointer
  149. to it and the length of the specified  string in the MC68000s' A0
  150. and D0 registers  each  time,  BUT  NOT  UNTIL  the registers are
  151. initialized. (See the "I" command)
  152.  
  153. Command: I    (Initialize MC68000 Registers)
  154. Example:
  155. -i            Initialize ALL MC68000 register values.
  156.  
  157.    When  initializing,  Command  line  tail  values  (if any) are
  158. installed in registers  A0  and  D0.   Also  initialized  are the
  159. Program  Counter,  and  User   Stack   Pointer  registers.   When
  160. initializing the USP, the top of stack is found, then the address
  161. of a termination routine is pushed onto the stack, so the program
  162. can run to   its  completion,  and  remain  in  the  Debugger for
  163. further examination.
  164.  
  165.                     * * * N O T E * * *
  166.  
  167.     The  following  conditions  AUTOMATICALLY   perform  the  "I"
  168. command:
  169. 1. Normal termination of the  program.  (registers  are displayed
  170. before reset).
  171. 2. Attempting to Load a file. (even if the load fails).
  172.  
  173. Command: G     (Go execute instructions)
  174. Examples:
  175. -g 100         Begin executing instructions at address $100
  176.  
  177. -g             Begin executing instructions at the address of the
  178.            Program Counter.  To  view  the  program  counter,  
  179.            use  the  "R" command.
  180.  
  181. The Go command supports break  points.   These may be inserted in
  182. the code by the programmer by  the  use  of the MC68000's ILLEGAL
  183. instruction, a TRAP, or  the  line  1010  & 1111 emulators.  Zero
  184. divide conditions, as well as  Privilege  violation,  and Address
  185. errors work  like  breakpoints.    Note  the  trap  number in the
  186. register frame to determine the cause of the break.
  187.  
  188. It is also important to note that  some types of errors including
  189. zero divide, TRAP #x, and  address  errors may alter the value of
  190. the program counter displayed  in  the  register frame.  In other
  191. words, it may be necessary  to  scan  back  a few bytes or words,
  192. with the disassembler to view the offensive instruction.
  193.  
  194.  
  195.  
  196. Command: T     (Execute in Trace mode)
  197. Example:
  198. -t             Trace  the  instruction  at  the  Current Program
  199.            Counter.
  200.  
  201. Trace works just like  Go,  except  that  only ONE instruction is
  202. executed, and a register frame is displayed AFTER the instruction
  203. executes.  Additionally, the  debugger  will disassemble the next
  204. instruction to be  executed.  A  trap  number  of  9 will usually
  205. appear when tracing. 
  206.  
  207. Note that due  to  characteristics  of  the  Amiga's multitasking
  208. system, attempting to trace  certain  types  of processor errors,
  209. including zero divide condition, can, and probably will crash the
  210. entire system.
  211.  
  212.  
  213. Command: Z      (Zip through a subroutine)
  214. Example:
  215. -z  Zip through instruction at the current Program Counter.
  216.  
  217. Zip is usefull when tracing  code.   When the next instruction to
  218. be executed is a BSR or a JSR and  tracing through the subroutine
  219. is not desirable, just press  "z".   The debugger will attempt to
  220. execute the subroutine, and  stop  at the instruction immediately
  221. following it.
  222.  
  223. Command: N      (Display next instruction)
  224. Example:
  225. -n              Disassemble   the  instruction  at  the  current
  226.         Program Counter.
  227.  
  228. The N command displays  the  instruction  that  the  MC68000 will
  229. attempt to Execute is the "G"  or  "T" or "Z" commands are issued
  230. with no paramaters. Note that "N"  also updates debugger internal
  231. variables so that "M" and "D"  defaults  are reset to the current
  232. Program Counter.
  233.  
  234.  
  235.             * * * * * *  Break Points * * * * *
  236.  
  237.  Debug supports limited,  multiple  break  points.  Up to 8 break
  238. points may be active at once. Use the -p command to view, set, or
  239. clear any or  all  break  points.  When  setting  a  break point, 
  240. the debugger stores the requested address of a break point, stores 
  241. the  contents  of  that  address,  and  replaces  it  with  a the
  242. MC68000's  ILLEGAL opcode.  Clearing the break point replaces the
  243. ILLEGAL instruction with  the  saved  contents.   When  the Amiga
  244. attempts to execute the  installed  ILLEGAL  instruction, via the
  245. 'g' or 'z' commands the debugger considers that a break point and
  246. displays the appropriate information.
  247.  
  248. Command:  P     Display all active break Points.
  249. Examples:
  250. -p              Lists all currently set break points.
  251.  
  252. -p 1            List  the  current  status  of break point number
  253.         one.
  254.  
  255. Command:  PS    break Point Set.
  256. Example:
  257. -ps 1 100       Sets Break point number one to address $100.
  258.  
  259. Command:  PC    break Point Clear.
  260. Example:
  261. -pc 1           Removes  break  point  one,  and  restores saved
  262.         contents of that address.
  263.  
  264. Command:  PX    Remove ALL break points.
  265. Example:
  266. -px             Remove any of  the  eight  break points that are
  267.             set.
  268.  
  269. Command:  W     Toggle private window on/off.
  270. Example:
  271. -w              Close private window  if it's open, Open private
  272.         window if it's closed. 
  273.  
  274.  
  275. Debug.doc Page 6
  276.  
  277.  
  278. Note that this window is only for  Debug's input and output - any
  279. program being debugged will have  its  own I/O streams. (Normally
  280. the CLI window).
  281.       
  282.  
  283.           - - - Number format conversions - - -
  284.  
  285. Command: $   (Display the value of hexidecimal input number)
  286. Example:
  287. -$ 400       Display the Decimal and Binary equates of $400
  288.  
  289. Command: %   (Display the value of binary input number
  290. Example:
  291. -% 1101101   Display  the  Decimal  and  Hexidecimal  equates of
  292.          %1101101
  293.  
  294. Command: +   (Display the value of decimal input number)
  295. Example:
  296. -+1024       Display the Hexidecimal  and Binary equates of +1024
  297.          Negative decimal  numbers  may  also  be  converted  
  298.          using  the + command.  Note that if  the  number  to  
  299.           be converted is negative the + command must be used, 
  300.          followed by "-" and the number.
  301. Example:
  302. -+-1024      Display the Hexadecimal and Binary equates of -1024  
  303.  
  304. Command: A   (Convert the specified APTR to a BPTR)
  305. Example:
  306. -a 4         Will convert the number $4 to a BPTR and display the
  307.          value of the computed BPTR.
  308.  
  309. Command: B   (Convert the specified BPTR to an APTR)
  310. Example:
  311. -b 1         Will convert the BPTR  $1 to an APTR and display the
  312.          value of the computed APTR.
  313.  
  314.